var aUi = aUi || {};
aUi.inventorings = {

	//拣货详情列表
	_addReceiptDetail: function(data) {
		var pickDetailQty = "0";
		var color = "#FC5959";
		var state = "未完成";

		if (data.warehousingQty != null) {
			pickDetailQty = data.warehousingQty;
		}

		var remainAmount = parseInt(data.qty) - parseInt(pickDetailQty);
		if (remainAmount == 0) {
			state = "已完成";
			color = "#0091FF"
		} else if (remainAmount < 0) {
			state = "已超量";
			color = "#00A651"
		}
		var html = '<li data-qty="' + data.qty + '" data-id="' + data.id + '" data-commoditybar="' + data.commoditybar +
			'" data-commodityname="' + data.commodityname +
			'" class="mui-table-view-cell mui-media item-cell" style="display:;">' +
			'<div class="content-top">' +
			'<div class="top-title">商品编码：' + data.commoditybar + '</div>' +
			'</div>' +
			'<div class="top-line"></div>' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../images/comman/icon_location.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.commodityname + '</p>' +
			'<p  style="color:' + color + '">' + state + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p >已入数量：' + pickDetailQty + '</p>' +
			'<p >总数量：' + data.qty + '</p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'</li>';
		return html;
	},


	details: function(list) {
		var html = "";
		for (var i = 0; i < list.length; i++) {
			var data = list[i];
			html += this._addReceiptDetail(data);
		}
		return html;
	},

	// 接货单列表
	_addReceiveList: function(data) {

		var color = "#FC5959";
		var state = "未完成";
		if (data.warehousingState != null) {
			if (data.warehousingState == 1) {
				var color = "#00A651";
				var state = "入库完成";
			}
		}

		var html = '<li  data-purchaseno="' + data.purchaseno + '"  data-purchaseid="' + data.purchaseid + '" data-id="' + data.id +
			'" class="mui-table-view-cell mui-media item-cell" style="display:;">' +
			'<div class="content-top">' +
			'<div class="top-title">接货单号：' + data.purchaseno + '</div>' +
			'</div>' +
			'<div class="top-line"></div>' +
			'<div class="content-mid">' +
			'<div class="left-image">' +
			'<img class="" src="../../../../images/comman/icon_location.png">' +
			'</div>' +
			'<div class="mid-text">' +
			'<div class="left-text">' +
			'<p class="cell-title">' + data.suppliername + '</p>' +
			'<p class="cell-time">' + data.customername + '</p>' +
			'</div>' +
			'<div class="right-text">' +
			'<p  style="color:' + color + '">' + state + '</p>' +
			'<p ></p>' +
			'</div>' +
			'</div>' +
			'</div>' +
			'<div class="top-line2"></div>' +
			'<div class="bottom-content">' +
			'<div class="user">' +
			'<div class="avarimage">' +
			'<img class="" src="../../../../images/me/icon_avatar.png">' +
			'</div>' +
			'<div class="name">' + data.creator + '</div>' +
			'</div>' +
			'<div class="time">' + data.createtime + '</div>' +
			'</div>' +
			'</li>';
		return html;
	},


	receiveList: function(list) {
		var html = "";
		for (var i = 0; i < list.length; i++) {
			var data = list[i];
			// if (data.audittime != null && data.audittime.length > 0) {
				html += this._addReceiveList(data);
			// }
		}
		return html;
	},

};
